﻿#region Using directives

using System;
using System.Data;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using NetROS.Tiers.Entities;
using NetROS.Tiers.Data;

#endregion

namespace NetROS.Tiers.Data.Bases
{	
	///<summary>
	/// This class is the base class for any <see cref="VwOsnovnaSredstvaProviderBase"/> implementation.
	/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
	///</summary>
	public abstract class VwOsnovnaSredstvaProviderBaseCore : EntityViewProviderBase<VwOsnovnaSredstva>
	{
		#region Custom Methods
		
		
		#endregion

		#region Helper Functions
		
		/*
		///<summary>
		/// Fill an VList&lt;VwOsnovnaSredstva&gt; From a DataSet
		///</summary>
		/// <param name="dataSet">the DataSet</param>
		/// <param name="rows">The collection to fill</param>
		/// <param name="start">Start row</param>
		/// <param name="pagelen">number of row.</param>
		///<returns><see chref="VList&lt;VwOsnovnaSredstva&gt;"/></returns>
		protected static VList&lt;VwOsnovnaSredstva&gt; Fill(DataSet dataSet, VList<VwOsnovnaSredstva> rows, int start, int pagelen)
		{
			if (dataSet.Tables.Count == 1)
			{
				return Fill(dataSet.Tables[0], rows, start, pagelen);
			}
			else
			{
				return new VList<VwOsnovnaSredstva>();
			}	
		}
		
		
		///<summary>
		/// Fill an VList&lt;VwOsnovnaSredstva&gt; From a DataTable
		///</summary>
		/// <param name="dataTable">the DataTable that hold the data.</param>
		/// <param name="rows">The collection to fill</param>
		/// <param name="start">Start row</param>
		/// <param name="pagelen">number of row.</param>
		///<returns><see chref="VList<VwOsnovnaSredstva>"/></returns>
		protected static VList&lt;VwOsnovnaSredstva&gt; Fill(DataTable dataTable, VList<VwOsnovnaSredstva> rows, int start, int pagelen)
		{
			int recordnum = 0;
			
			System.Collections.IEnumerator dataRows =  dataTable.Rows.GetEnumerator();
			
			while (dataRows.MoveNext() && (pagelen != 0))
			{
				if(recordnum >= start)
				{
					DataRow row = (DataRow)dataRows.Current;
				
					VwOsnovnaSredstva c = new VwOsnovnaSredstva();
					c.Sifra = (Convert.IsDBNull(row["Sifra"]))?string.Empty:(System.String)row["Sifra"];
					c.NazivOS = (Convert.IsDBNull(row["NazivOS"]))?string.Empty:(System.String)row["NazivOS"];
					c.VezaNAOS = (Convert.IsDBNull(row["VezaNAOS"]))?string.Empty:(System.String)row["VezaNAOS"];
					c.KontoNabave = (Convert.IsDBNull(row["KontoNabave"]))?string.Empty:(System.String)row["KontoNabave"];
					c.KontoTroska = (Convert.IsDBNull(row["KontoTroska"]))?string.Empty:(System.String)row["KontoTroska"];
					c.KontoIspravka = (Convert.IsDBNull(row["KontoIspravka"]))?string.Empty:(System.String)row["KontoIspravka"];
					c.AmortStopa = (Convert.IsDBNull(row["AmortStopa"]))?0.0F:(System.Single?)row["AmortStopa"];
					c.AmortGrupa = (Convert.IsDBNull(row["AmortGrupa"]))?string.Empty:(System.String)row["AmortGrupa"];
					c.ZaduzenaOsoba = (Convert.IsDBNull(row["ZaduzenaOsoba"]))?string.Empty:(System.String)row["ZaduzenaOsoba"];
					c.MjestoTroska = (Convert.IsDBNull(row["MjestoTroska"]))?string.Empty:(System.String)row["MjestoTroska"];
					c.DatumKnjizenja = (Convert.IsDBNull(row["DatumKnjizenja"]))?DateTime.MinValue:(System.DateTime?)row["DatumKnjizenja"];
					c.DatumAktivacije = (Convert.IsDBNull(row["DatumAktivacije"]))?DateTime.MinValue:(System.DateTime?)row["DatumAktivacije"];
					c.DatumZadnjegObracunaOtpis = (Convert.IsDBNull(row["DatumZadnjegObracunaOtpis"]))?DateTime.MinValue:(System.DateTime?)row["DatumZadnjegObracunaOtpis"];
					c.NabVrijednost = (Convert.IsDBNull(row["NabVrijednost"]))?0:(System.Decimal?)row["NabVrijednost"];
					c.SadasnjaVrijed = (Convert.IsDBNull(row["SadasnjaVrijed"]))?0:(System.Decimal?)row["SadasnjaVrijed"];
					c.ZadnjaAmortizacija = (Convert.IsDBNull(row["ZadnjaAmortizacija"]))?0:(System.Decimal?)row["ZadnjaAmortizacija"];
					c.SaldoIspravka = (Convert.IsDBNull(row["SaldoIspravka"]))?0:(System.Decimal?)row["SaldoIspravka"];
					c.Opis = (Convert.IsDBNull(row["Opis"]))?string.Empty:(System.String)row["Opis"];
					c.Napomena = (Convert.IsDBNull(row["Napomena"]))?string.Empty:(System.String)row["Napomena"];
					c.Dobavljac = (Convert.IsDBNull(row["Dobavljac"]))?string.Empty:(System.String)row["Dobavljac"];
					c.GrupaOS = (Convert.IsDBNull(row["GrupaOS"]))?string.Empty:(System.String)row["GrupaOS"];
					c.Kolicina = (Convert.IsDBNull(row["Kolicina"]))?0:(System.Decimal?)row["Kolicina"];
					c.Tip = (Convert.IsDBNull(row["Tip"]))?string.Empty:(System.String)row["Tip"];
					c.RB = (Convert.IsDBNull(row["RB"]))?(int)0:(System.Int32)row["RB"];
					c.OSID = (Convert.IsDBNull(row["OSID"]))?(int)0:(System.Int32)row["OSID"];
					c.OSParentID = (Convert.IsDBNull(row["OSParentID"]))?(int)0:(System.Int32?)row["OSParentID"];
					c.OSKarticaID = (Convert.IsDBNull(row["OSKarticaID"]))?(int)0:(System.Int32?)row["OSKarticaID"];
					c.OSAmortID = (Convert.IsDBNull(row["OSAmortID"]))?(int)0:(System.Int32?)row["OSAmortID"];
					c.OsobaID = (Convert.IsDBNull(row["OsobaID"]))?(int)0:(System.Int32?)row["OsobaID"];
					c.MjestoTroskaID = (Convert.IsDBNull(row["MjestoTroskaID"]))?(int)0:(System.Int32?)row["MjestoTroskaID"];
					c.OSKarticaStatus = (Convert.IsDBNull(row["OSKarticaStatus"]))?(int)0:(System.Int32?)row["OSKarticaStatus"];
					c.AcceptChanges();
					rows.Add(c);
					pagelen -= 1;
				}
				recordnum += 1;
			}
			return rows;
		}
		*/	
						
		///<summary>
		/// Fill an <see cref="VList&lt;VwOsnovnaSredstva&gt;"/> From a DataReader.
		///</summary>
		/// <param name="reader">Datareader</param>
		/// <param name="rows">The collection to fill</param>
		/// <param name="start">Start row</param>
		/// <param name="pageLength">number of row.</param>
		///<returns>a <see cref="VList&lt;VwOsnovnaSredstva&gt;"/></returns>
		protected VList<VwOsnovnaSredstva> Fill(IDataReader reader, VList<VwOsnovnaSredstva> rows, int start, int pageLength)
		{
			int recordnum = 0;
			while (reader.Read() && (pageLength != 0))
			{
				if(recordnum >= start)
				{
					VwOsnovnaSredstva entity = null;
					if (DataRepository.Provider.UseEntityFactory)
					{
						entity = EntityManager.CreateViewEntity<VwOsnovnaSredstva>("VwOsnovnaSredstva",  DataRepository.Provider.EntityCreationalFactoryType); 
					}
					else
					{
						entity = new VwOsnovnaSredstva();
					}
					entity.Sifra = (System.String)reader["Sifra"];
					//entity.Sifra = (Convert.IsDBNull(reader["Sifra"]))?string.Empty:(System.String)reader["Sifra"];
					entity.NazivOS = reader.IsDBNull(reader.GetOrdinal("NazivOS")) ? null : (System.String)reader["NazivOS"];
					//entity.NazivOS = (Convert.IsDBNull(reader["NazivOS"]))?string.Empty:(System.String)reader["NazivOS"];
					entity.VezaNAOS = (System.String)reader["VezaNAOS"];
					//entity.VezaNAOS = (Convert.IsDBNull(reader["VezaNAOS"]))?string.Empty:(System.String)reader["VezaNAOS"];
					entity.KontoNabave = reader.IsDBNull(reader.GetOrdinal("KontoNabave")) ? null : (System.String)reader["KontoNabave"];
					//entity.KontoNabave = (Convert.IsDBNull(reader["KontoNabave"]))?string.Empty:(System.String)reader["KontoNabave"];
					entity.KontoTroska = reader.IsDBNull(reader.GetOrdinal("KontoTroska")) ? null : (System.String)reader["KontoTroska"];
					//entity.KontoTroska = (Convert.IsDBNull(reader["KontoTroska"]))?string.Empty:(System.String)reader["KontoTroska"];
					entity.KontoIspravka = reader.IsDBNull(reader.GetOrdinal("KontoIspravka")) ? null : (System.String)reader["KontoIspravka"];
					//entity.KontoIspravka = (Convert.IsDBNull(reader["KontoIspravka"]))?string.Empty:(System.String)reader["KontoIspravka"];
					entity.AmortStopa = reader.IsDBNull(reader.GetOrdinal("AmortStopa")) ? null : (System.Single?)reader["AmortStopa"];
					//entity.AmortStopa = (Convert.IsDBNull(reader["AmortStopa"]))?0.0F:(System.Single?)reader["AmortStopa"];
					entity.AmortGrupa = reader.IsDBNull(reader.GetOrdinal("AmortGrupa")) ? null : (System.String)reader["AmortGrupa"];
					//entity.AmortGrupa = (Convert.IsDBNull(reader["AmortGrupa"]))?string.Empty:(System.String)reader["AmortGrupa"];
					entity.ZaduzenaOsoba = reader.IsDBNull(reader.GetOrdinal("ZaduzenaOsoba")) ? null : (System.String)reader["ZaduzenaOsoba"];
					//entity.ZaduzenaOsoba = (Convert.IsDBNull(reader["ZaduzenaOsoba"]))?string.Empty:(System.String)reader["ZaduzenaOsoba"];
					entity.MjestoTroska = reader.IsDBNull(reader.GetOrdinal("MjestoTroska")) ? null : (System.String)reader["MjestoTroska"];
					//entity.MjestoTroska = (Convert.IsDBNull(reader["MjestoTroska"]))?string.Empty:(System.String)reader["MjestoTroska"];
					entity.DatumKnjizenja = reader.IsDBNull(reader.GetOrdinal("DatumKnjizenja")) ? null : (System.DateTime?)reader["DatumKnjizenja"];
					//entity.DatumKnjizenja = (Convert.IsDBNull(reader["DatumKnjizenja"]))?DateTime.MinValue:(System.DateTime?)reader["DatumKnjizenja"];
					entity.DatumAktivacije = reader.IsDBNull(reader.GetOrdinal("DatumAktivacije")) ? null : (System.DateTime?)reader["DatumAktivacije"];
					//entity.DatumAktivacije = (Convert.IsDBNull(reader["DatumAktivacije"]))?DateTime.MinValue:(System.DateTime?)reader["DatumAktivacije"];
					entity.DatumZadnjegObracunaOtpis = reader.IsDBNull(reader.GetOrdinal("DatumZadnjegObracunaOtpis")) ? null : (System.DateTime?)reader["DatumZadnjegObracunaOtpis"];
					//entity.DatumZadnjegObracunaOtpis = (Convert.IsDBNull(reader["DatumZadnjegObracunaOtpis"]))?DateTime.MinValue:(System.DateTime?)reader["DatumZadnjegObracunaOtpis"];
					entity.NabVrijednost = reader.IsDBNull(reader.GetOrdinal("NabVrijednost")) ? null : (System.Decimal?)reader["NabVrijednost"];
					//entity.NabVrijednost = (Convert.IsDBNull(reader["NabVrijednost"]))?0:(System.Decimal?)reader["NabVrijednost"];
					entity.SadasnjaVrijed = reader.IsDBNull(reader.GetOrdinal("SadasnjaVrijed")) ? null : (System.Decimal?)reader["SadasnjaVrijed"];
					//entity.SadasnjaVrijed = (Convert.IsDBNull(reader["SadasnjaVrijed"]))?0:(System.Decimal?)reader["SadasnjaVrijed"];
					entity.ZadnjaAmortizacija = reader.IsDBNull(reader.GetOrdinal("ZadnjaAmortizacija")) ? null : (System.Decimal?)reader["ZadnjaAmortizacija"];
					//entity.ZadnjaAmortizacija = (Convert.IsDBNull(reader["ZadnjaAmortizacija"]))?0:(System.Decimal?)reader["ZadnjaAmortizacija"];
					entity.SaldoIspravka = reader.IsDBNull(reader.GetOrdinal("SaldoIspravka")) ? null : (System.Decimal?)reader["SaldoIspravka"];
					//entity.SaldoIspravka = (Convert.IsDBNull(reader["SaldoIspravka"]))?0:(System.Decimal?)reader["SaldoIspravka"];
					entity.Opis = reader.IsDBNull(reader.GetOrdinal("Opis")) ? null : (System.String)reader["Opis"];
					//entity.Opis = (Convert.IsDBNull(reader["Opis"]))?string.Empty:(System.String)reader["Opis"];
					entity.Napomena = reader.IsDBNull(reader.GetOrdinal("Napomena")) ? null : (System.String)reader["Napomena"];
					//entity.Napomena = (Convert.IsDBNull(reader["Napomena"]))?string.Empty:(System.String)reader["Napomena"];
					entity.Dobavljac = reader.IsDBNull(reader.GetOrdinal("Dobavljac")) ? null : (System.String)reader["Dobavljac"];
					//entity.Dobavljac = (Convert.IsDBNull(reader["Dobavljac"]))?string.Empty:(System.String)reader["Dobavljac"];
					entity.GrupaOS = reader.IsDBNull(reader.GetOrdinal("GrupaOS")) ? null : (System.String)reader["GrupaOS"];
					//entity.GrupaOS = (Convert.IsDBNull(reader["GrupaOS"]))?string.Empty:(System.String)reader["GrupaOS"];
					entity.Kolicina = reader.IsDBNull(reader.GetOrdinal("Kolicina")) ? null : (System.Decimal?)reader["Kolicina"];
					//entity.Kolicina = (Convert.IsDBNull(reader["Kolicina"]))?0:(System.Decimal?)reader["Kolicina"];
					entity.Tip = (System.String)reader["Tip"];
					//entity.Tip = (Convert.IsDBNull(reader["Tip"]))?string.Empty:(System.String)reader["Tip"];
					entity.RB = (System.Int32)reader["RB"];
					//entity.RB = (Convert.IsDBNull(reader["RB"]))?(int)0:(System.Int32)reader["RB"];
					entity.OSID = (System.Int32)reader["OSID"];
					//entity.OSID = (Convert.IsDBNull(reader["OSID"]))?(int)0:(System.Int32)reader["OSID"];
					entity.OSParentID = reader.IsDBNull(reader.GetOrdinal("OSParentID")) ? null : (System.Int32?)reader["OSParentID"];
					//entity.OSParentID = (Convert.IsDBNull(reader["OSParentID"]))?(int)0:(System.Int32?)reader["OSParentID"];
					entity.OSKarticaID = reader.IsDBNull(reader.GetOrdinal("OSKarticaID")) ? null : (System.Int32?)reader["OSKarticaID"];
					//entity.OSKarticaID = (Convert.IsDBNull(reader["OSKarticaID"]))?(int)0:(System.Int32?)reader["OSKarticaID"];
					entity.OSAmortID = reader.IsDBNull(reader.GetOrdinal("OSAmortID")) ? null : (System.Int32?)reader["OSAmortID"];
					//entity.OSAmortID = (Convert.IsDBNull(reader["OSAmortID"]))?(int)0:(System.Int32?)reader["OSAmortID"];
					entity.OsobaID = reader.IsDBNull(reader.GetOrdinal("OsobaID")) ? null : (System.Int32?)reader["OsobaID"];
					//entity.OsobaID = (Convert.IsDBNull(reader["OsobaID"]))?(int)0:(System.Int32?)reader["OsobaID"];
					entity.MjestoTroskaID = reader.IsDBNull(reader.GetOrdinal("MjestoTroskaID")) ? null : (System.Int32?)reader["MjestoTroskaID"];
					//entity.MjestoTroskaID = (Convert.IsDBNull(reader["MjestoTroskaID"]))?(int)0:(System.Int32?)reader["MjestoTroskaID"];
					entity.OSKarticaStatus = reader.IsDBNull(reader.GetOrdinal("OSKarticaStatus")) ? null : (System.Int32?)reader["OSKarticaStatus"];
					//entity.OSKarticaStatus = (Convert.IsDBNull(reader["OSKarticaStatus"]))?(int)0:(System.Int32?)reader["OSKarticaStatus"];
					entity.AcceptChanges();
					rows.Add(entity);
					pageLength -= 1;
				}
				recordnum += 1;
			}
			return rows;
		}
		
		
		/// <summary>
		/// Refreshes the <see cref="VwOsnovnaSredstva"/> object from the <see cref="IDataReader"/>.
		/// </summary>
		/// <param name="reader">The <see cref="IDataReader"/> to read from.</param>
		/// <param name="entity">The <see cref="VwOsnovnaSredstva"/> object to refresh.</param>
		protected void RefreshEntity(IDataReader reader, VwOsnovnaSredstva entity)
		{
			reader.Read();
			entity.Sifra = (System.String)reader["Sifra"];
			//entity.Sifra = (Convert.IsDBNull(reader["Sifra"]))?string.Empty:(System.String)reader["Sifra"];
			entity.NazivOS = reader.IsDBNull(reader.GetOrdinal("NazivOS")) ? null : (System.String)reader["NazivOS"];
			//entity.NazivOS = (Convert.IsDBNull(reader["NazivOS"]))?string.Empty:(System.String)reader["NazivOS"];
			entity.VezaNAOS = (System.String)reader["VezaNAOS"];
			//entity.VezaNAOS = (Convert.IsDBNull(reader["VezaNAOS"]))?string.Empty:(System.String)reader["VezaNAOS"];
			entity.KontoNabave = reader.IsDBNull(reader.GetOrdinal("KontoNabave")) ? null : (System.String)reader["KontoNabave"];
			//entity.KontoNabave = (Convert.IsDBNull(reader["KontoNabave"]))?string.Empty:(System.String)reader["KontoNabave"];
			entity.KontoTroska = reader.IsDBNull(reader.GetOrdinal("KontoTroska")) ? null : (System.String)reader["KontoTroska"];
			//entity.KontoTroska = (Convert.IsDBNull(reader["KontoTroska"]))?string.Empty:(System.String)reader["KontoTroska"];
			entity.KontoIspravka = reader.IsDBNull(reader.GetOrdinal("KontoIspravka")) ? null : (System.String)reader["KontoIspravka"];
			//entity.KontoIspravka = (Convert.IsDBNull(reader["KontoIspravka"]))?string.Empty:(System.String)reader["KontoIspravka"];
			entity.AmortStopa = reader.IsDBNull(reader.GetOrdinal("AmortStopa")) ? null : (System.Single?)reader["AmortStopa"];
			//entity.AmortStopa = (Convert.IsDBNull(reader["AmortStopa"]))?0.0F:(System.Single?)reader["AmortStopa"];
			entity.AmortGrupa = reader.IsDBNull(reader.GetOrdinal("AmortGrupa")) ? null : (System.String)reader["AmortGrupa"];
			//entity.AmortGrupa = (Convert.IsDBNull(reader["AmortGrupa"]))?string.Empty:(System.String)reader["AmortGrupa"];
			entity.ZaduzenaOsoba = reader.IsDBNull(reader.GetOrdinal("ZaduzenaOsoba")) ? null : (System.String)reader["ZaduzenaOsoba"];
			//entity.ZaduzenaOsoba = (Convert.IsDBNull(reader["ZaduzenaOsoba"]))?string.Empty:(System.String)reader["ZaduzenaOsoba"];
			entity.MjestoTroska = reader.IsDBNull(reader.GetOrdinal("MjestoTroska")) ? null : (System.String)reader["MjestoTroska"];
			//entity.MjestoTroska = (Convert.IsDBNull(reader["MjestoTroska"]))?string.Empty:(System.String)reader["MjestoTroska"];
			entity.DatumKnjizenja = reader.IsDBNull(reader.GetOrdinal("DatumKnjizenja")) ? null : (System.DateTime?)reader["DatumKnjizenja"];
			//entity.DatumKnjizenja = (Convert.IsDBNull(reader["DatumKnjizenja"]))?DateTime.MinValue:(System.DateTime?)reader["DatumKnjizenja"];
			entity.DatumAktivacije = reader.IsDBNull(reader.GetOrdinal("DatumAktivacije")) ? null : (System.DateTime?)reader["DatumAktivacije"];
			//entity.DatumAktivacije = (Convert.IsDBNull(reader["DatumAktivacije"]))?DateTime.MinValue:(System.DateTime?)reader["DatumAktivacije"];
			entity.DatumZadnjegObracunaOtpis = reader.IsDBNull(reader.GetOrdinal("DatumZadnjegObracunaOtpis")) ? null : (System.DateTime?)reader["DatumZadnjegObracunaOtpis"];
			//entity.DatumZadnjegObracunaOtpis = (Convert.IsDBNull(reader["DatumZadnjegObracunaOtpis"]))?DateTime.MinValue:(System.DateTime?)reader["DatumZadnjegObracunaOtpis"];
			entity.NabVrijednost = reader.IsDBNull(reader.GetOrdinal("NabVrijednost")) ? null : (System.Decimal?)reader["NabVrijednost"];
			//entity.NabVrijednost = (Convert.IsDBNull(reader["NabVrijednost"]))?0:(System.Decimal?)reader["NabVrijednost"];
			entity.SadasnjaVrijed = reader.IsDBNull(reader.GetOrdinal("SadasnjaVrijed")) ? null : (System.Decimal?)reader["SadasnjaVrijed"];
			//entity.SadasnjaVrijed = (Convert.IsDBNull(reader["SadasnjaVrijed"]))?0:(System.Decimal?)reader["SadasnjaVrijed"];
			entity.ZadnjaAmortizacija = reader.IsDBNull(reader.GetOrdinal("ZadnjaAmortizacija")) ? null : (System.Decimal?)reader["ZadnjaAmortizacija"];
			//entity.ZadnjaAmortizacija = (Convert.IsDBNull(reader["ZadnjaAmortizacija"]))?0:(System.Decimal?)reader["ZadnjaAmortizacija"];
			entity.SaldoIspravka = reader.IsDBNull(reader.GetOrdinal("SaldoIspravka")) ? null : (System.Decimal?)reader["SaldoIspravka"];
			//entity.SaldoIspravka = (Convert.IsDBNull(reader["SaldoIspravka"]))?0:(System.Decimal?)reader["SaldoIspravka"];
			entity.Opis = reader.IsDBNull(reader.GetOrdinal("Opis")) ? null : (System.String)reader["Opis"];
			//entity.Opis = (Convert.IsDBNull(reader["Opis"]))?string.Empty:(System.String)reader["Opis"];
			entity.Napomena = reader.IsDBNull(reader.GetOrdinal("Napomena")) ? null : (System.String)reader["Napomena"];
			//entity.Napomena = (Convert.IsDBNull(reader["Napomena"]))?string.Empty:(System.String)reader["Napomena"];
			entity.Dobavljac = reader.IsDBNull(reader.GetOrdinal("Dobavljac")) ? null : (System.String)reader["Dobavljac"];
			//entity.Dobavljac = (Convert.IsDBNull(reader["Dobavljac"]))?string.Empty:(System.String)reader["Dobavljac"];
			entity.GrupaOS = reader.IsDBNull(reader.GetOrdinal("GrupaOS")) ? null : (System.String)reader["GrupaOS"];
			//entity.GrupaOS = (Convert.IsDBNull(reader["GrupaOS"]))?string.Empty:(System.String)reader["GrupaOS"];
			entity.Kolicina = reader.IsDBNull(reader.GetOrdinal("Kolicina")) ? null : (System.Decimal?)reader["Kolicina"];
			//entity.Kolicina = (Convert.IsDBNull(reader["Kolicina"]))?0:(System.Decimal?)reader["Kolicina"];
			entity.Tip = (System.String)reader["Tip"];
			//entity.Tip = (Convert.IsDBNull(reader["Tip"]))?string.Empty:(System.String)reader["Tip"];
			entity.RB = (System.Int32)reader["RB"];
			//entity.RB = (Convert.IsDBNull(reader["RB"]))?(int)0:(System.Int32)reader["RB"];
			entity.OSID = (System.Int32)reader["OSID"];
			//entity.OSID = (Convert.IsDBNull(reader["OSID"]))?(int)0:(System.Int32)reader["OSID"];
			entity.OSParentID = reader.IsDBNull(reader.GetOrdinal("OSParentID")) ? null : (System.Int32?)reader["OSParentID"];
			//entity.OSParentID = (Convert.IsDBNull(reader["OSParentID"]))?(int)0:(System.Int32?)reader["OSParentID"];
			entity.OSKarticaID = reader.IsDBNull(reader.GetOrdinal("OSKarticaID")) ? null : (System.Int32?)reader["OSKarticaID"];
			//entity.OSKarticaID = (Convert.IsDBNull(reader["OSKarticaID"]))?(int)0:(System.Int32?)reader["OSKarticaID"];
			entity.OSAmortID = reader.IsDBNull(reader.GetOrdinal("OSAmortID")) ? null : (System.Int32?)reader["OSAmortID"];
			//entity.OSAmortID = (Convert.IsDBNull(reader["OSAmortID"]))?(int)0:(System.Int32?)reader["OSAmortID"];
			entity.OsobaID = reader.IsDBNull(reader.GetOrdinal("OsobaID")) ? null : (System.Int32?)reader["OsobaID"];
			//entity.OsobaID = (Convert.IsDBNull(reader["OsobaID"]))?(int)0:(System.Int32?)reader["OsobaID"];
			entity.MjestoTroskaID = reader.IsDBNull(reader.GetOrdinal("MjestoTroskaID")) ? null : (System.Int32?)reader["MjestoTroskaID"];
			//entity.MjestoTroskaID = (Convert.IsDBNull(reader["MjestoTroskaID"]))?(int)0:(System.Int32?)reader["MjestoTroskaID"];
			entity.OSKarticaStatus = reader.IsDBNull(reader.GetOrdinal("OSKarticaStatus")) ? null : (System.Int32?)reader["OSKarticaStatus"];
			//entity.OSKarticaStatus = (Convert.IsDBNull(reader["OSKarticaStatus"]))?(int)0:(System.Int32?)reader["OSKarticaStatus"];
			reader.Close();
	
			entity.AcceptChanges();
		}
		
		/*
		/// <summary>
		/// Refreshes the <see cref="VwOsnovnaSredstva"/> object from the <see cref="DataSet"/>.
		/// </summary>
		/// <param name="dataSet">The <see cref="DataSet"/> to read from.</param>
		/// <param name="entity">The <see cref="VwOsnovnaSredstva"/> object.</param>
		protected static void RefreshEntity(DataSet dataSet, VwOsnovnaSredstva entity)
		{
			DataRow dataRow = dataSet.Tables[0].Rows[0];
			
			entity.Sifra = (Convert.IsDBNull(dataRow["Sifra"]))?string.Empty:(System.String)dataRow["Sifra"];
			entity.NazivOS = (Convert.IsDBNull(dataRow["NazivOS"]))?string.Empty:(System.String)dataRow["NazivOS"];
			entity.VezaNAOS = (Convert.IsDBNull(dataRow["VezaNAOS"]))?string.Empty:(System.String)dataRow["VezaNAOS"];
			entity.KontoNabave = (Convert.IsDBNull(dataRow["KontoNabave"]))?string.Empty:(System.String)dataRow["KontoNabave"];
			entity.KontoTroska = (Convert.IsDBNull(dataRow["KontoTroska"]))?string.Empty:(System.String)dataRow["KontoTroska"];
			entity.KontoIspravka = (Convert.IsDBNull(dataRow["KontoIspravka"]))?string.Empty:(System.String)dataRow["KontoIspravka"];
			entity.AmortStopa = (Convert.IsDBNull(dataRow["AmortStopa"]))?0.0F:(System.Single?)dataRow["AmortStopa"];
			entity.AmortGrupa = (Convert.IsDBNull(dataRow["AmortGrupa"]))?string.Empty:(System.String)dataRow["AmortGrupa"];
			entity.ZaduzenaOsoba = (Convert.IsDBNull(dataRow["ZaduzenaOsoba"]))?string.Empty:(System.String)dataRow["ZaduzenaOsoba"];
			entity.MjestoTroska = (Convert.IsDBNull(dataRow["MjestoTroska"]))?string.Empty:(System.String)dataRow["MjestoTroska"];
			entity.DatumKnjizenja = (Convert.IsDBNull(dataRow["DatumKnjizenja"]))?DateTime.MinValue:(System.DateTime?)dataRow["DatumKnjizenja"];
			entity.DatumAktivacije = (Convert.IsDBNull(dataRow["DatumAktivacije"]))?DateTime.MinValue:(System.DateTime?)dataRow["DatumAktivacije"];
			entity.DatumZadnjegObracunaOtpis = (Convert.IsDBNull(dataRow["DatumZadnjegObracunaOtpis"]))?DateTime.MinValue:(System.DateTime?)dataRow["DatumZadnjegObracunaOtpis"];
			entity.NabVrijednost = (Convert.IsDBNull(dataRow["NabVrijednost"]))?0:(System.Decimal?)dataRow["NabVrijednost"];
			entity.SadasnjaVrijed = (Convert.IsDBNull(dataRow["SadasnjaVrijed"]))?0:(System.Decimal?)dataRow["SadasnjaVrijed"];
			entity.ZadnjaAmortizacija = (Convert.IsDBNull(dataRow["ZadnjaAmortizacija"]))?0:(System.Decimal?)dataRow["ZadnjaAmortizacija"];
			entity.SaldoIspravka = (Convert.IsDBNull(dataRow["SaldoIspravka"]))?0:(System.Decimal?)dataRow["SaldoIspravka"];
			entity.Opis = (Convert.IsDBNull(dataRow["Opis"]))?string.Empty:(System.String)dataRow["Opis"];
			entity.Napomena = (Convert.IsDBNull(dataRow["Napomena"]))?string.Empty:(System.String)dataRow["Napomena"];
			entity.Dobavljac = (Convert.IsDBNull(dataRow["Dobavljac"]))?string.Empty:(System.String)dataRow["Dobavljac"];
			entity.GrupaOS = (Convert.IsDBNull(dataRow["GrupaOS"]))?string.Empty:(System.String)dataRow["GrupaOS"];
			entity.Kolicina = (Convert.IsDBNull(dataRow["Kolicina"]))?0:(System.Decimal?)dataRow["Kolicina"];
			entity.Tip = (Convert.IsDBNull(dataRow["Tip"]))?string.Empty:(System.String)dataRow["Tip"];
			entity.RB = (Convert.IsDBNull(dataRow["RB"]))?(int)0:(System.Int32)dataRow["RB"];
			entity.OSID = (Convert.IsDBNull(dataRow["OSID"]))?(int)0:(System.Int32)dataRow["OSID"];
			entity.OSParentID = (Convert.IsDBNull(dataRow["OSParentID"]))?(int)0:(System.Int32?)dataRow["OSParentID"];
			entity.OSKarticaID = (Convert.IsDBNull(dataRow["OSKarticaID"]))?(int)0:(System.Int32?)dataRow["OSKarticaID"];
			entity.OSAmortID = (Convert.IsDBNull(dataRow["OSAmortID"]))?(int)0:(System.Int32?)dataRow["OSAmortID"];
			entity.OsobaID = (Convert.IsDBNull(dataRow["OsobaID"]))?(int)0:(System.Int32?)dataRow["OsobaID"];
			entity.MjestoTroskaID = (Convert.IsDBNull(dataRow["MjestoTroskaID"]))?(int)0:(System.Int32?)dataRow["MjestoTroskaID"];
			entity.OSKarticaStatus = (Convert.IsDBNull(dataRow["OSKarticaStatus"]))?(int)0:(System.Int32?)dataRow["OSKarticaStatus"];
			entity.AcceptChanges();
		}
		*/
			
		#endregion Helper Functions
	}//end class

	#region VwOsnovnaSredstvaFilterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="SqlFilterBuilder&lt;EntityColumn&gt;"/> class
	/// that is used exclusively with a <see cref="VwOsnovnaSredstva"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class VwOsnovnaSredstvaFilterBuilder : SqlFilterBuilder<VwOsnovnaSredstvaColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the VwOsnovnaSredstvaFilterBuilder class.
		/// </summary>
		public VwOsnovnaSredstvaFilterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the VwOsnovnaSredstvaFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public VwOsnovnaSredstvaFilterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the VwOsnovnaSredstvaFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public VwOsnovnaSredstvaFilterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion VwOsnovnaSredstvaFilterBuilder

	#region VwOsnovnaSredstvaParameterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="ParameterizedSqlFilterBuilder&lt;EntityColumn&gt;"/> class
	/// that is used exclusively with a <see cref="VwOsnovnaSredstva"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class VwOsnovnaSredstvaParameterBuilder : ParameterizedSqlFilterBuilder<VwOsnovnaSredstvaColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the VwOsnovnaSredstvaParameterBuilder class.
		/// </summary>
		public VwOsnovnaSredstvaParameterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the VwOsnovnaSredstvaParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public VwOsnovnaSredstvaParameterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the VwOsnovnaSredstvaParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public VwOsnovnaSredstvaParameterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion VwOsnovnaSredstvaParameterBuilder
} // end namespace
